The plug in launches a thread which reads the HillCrest FSM-9 sensor as fast as possible.  The main plug in
update() function then reads the returned quaternion.  There appears to be some stuttering.  I think it's because
the tracker runs at 100Hz and the update() function runs at 60Hz and they're not synchronized.  Needs more testing.

HillCrestFSM9.dle should go in the Vizard Plug in folder.  Ex: C:\Program Files (x86)\WorldViz\Vizard5\plug-ins
The pthread files (2 of them) should go in the Vizard bin folder.  Ex: C:\Program Files (x86)\WorldViz\Vizard5\bin

Then you can use a simple link.

#FSM-9 head tracking
hillcrest=viz.add('HillCrestFSM9.dle')
fsm9=hillcrest.addSensor()

trackerLink=viz.link(fsm9,viz.MainView)


You can also use manual tracking in a script in Vizard like shown below.  Your yaw, pitch, and roll relationship 
will depend on how you mount the FSM9 to whatever you're tracking.

#FSM-9 head tracking
hillcrest=viz.add('HillCrestFSM9.dle')
fsm9=hillcrest.addSensor()

# This function will grab the tracker data and update the viewpoint
def UpdateView():

    #Get tracker euler rotation
    roll,pitch,yaw = fsm9.getEuler(viz.ABS_GLOBAL)
    #print fsm9.getQuat()

    #Only rotate the yaw of the body orientation
    viz.MainView.setEuler([yaw,pitch,roll],viz.HEAD_ORI)

#Call UpdateView function every frame
vizact.ontimer(0,UpdateView)

#Reset tracker when 'r' key is pressed
vizact.onkeydown('r',fsm9.reset)
